<extend name="Public/usercenter"/>

<block name="body">
    <div class="row">
        <div class="col-xs-12">
            <p>&nbsp;</p>
            <h4>修改密码</h4>
            <hr class="oneuser-title-hr"/>
        </div>
    </div>

    <form id="changePasswordForm" action="{:U('UserCenter/Index/doChangePassword')}" method="post" class="ajax-form">
        <div class="row">
            <div class="col-xs-3">
                <p class="pull-right">旧密码：</p>
            </div>
            <div class="col-xs-6">
                <p><input type="password" id="inputOldPassword" class="form-control" name="old_password" placeholder="输入旧密码"/></p>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-3">
                <p class="pull-right">新密码：</p>
            </div>
            <div class="col-xs-6">
                <p><input type="password" id="inputNewPassword" class="form-control" name="new_password" placeholder="输入新密码"/></p>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-3">
                <p class="pull-right">确认密码：</p>
            </div>
            <div class="col-xs-6">
                <p><input type="password" id="inputConfirmPassword" class="form-control" name="confirm_password" placeholder="输入确认密码"/></p>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-3">
                &nbsp;
            </div>
            <div class="col-xs-6">
                <p class="text-danger" id="submitTip"></p>
                <p><input type="submit" class="btn btn-primary" value="修改密码"/></p>
            </div>
        </div>
    </form>

</block>

<block name="script">
    <script>
        //检查两次输入的密码是否一致
        $(function(){
            $('#changePasswordForm').submit(function(e){
                var newPassword = $('#inputNewPassword').val();
                var confirmPassword = $('#inputConfirmPassword').val();
                if(newPassword != confirmPassword) {
                    op_error('两次输入的密码不一致');
                    e.stopPropagation();
                    return false;
                }
            })
        })
    </script>
</block>